Skip to content

fix: accept a table ARN as TableName in data-plane operations - #200

Open
yesyayen wants to merge 1 commit into
ExtendDB:mainfrom
yesyayen:fix/table-arn-as-name
Open

fix: accept a table ARN as TableName in data-plane operations#200
yesyayen wants to merge 1 commit into
ExtendDB:mainfrom
yesyayen:fix/table-arn-as-name

Conversation

@yesyayen

@yesyayen yesyayen commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

What

Resolve a table ARN supplied in place of a bare table name to its bare name, matching Amazon DynamoDB and DynamoDB Local. Normalizes the wire TableName, batch RequestItems keys, and transact sub-op table names in the request path so authorization, validation, throttling, and echoed names all see the bare name. Index, non-table, and malformed ARNs are rejected as ValidationException. Account and region are ignored (name resolves within the caller's account), matching DynamoDB Local.

Behavior: before vs Amazon DynamoDB

Captured from Amazon DynamoDB and DynamoDB Local via the AWS CLI:

Scenario ExtendDB (before) Amazon DynamoDB / DynamoDB Local
GetItem/PutItem/Query with a same-account table ARN as TableName ResourceNotFoundException Resolves and serves the request
BatchGetItem/BatchWriteItem with an ARN RequestItems key ResourceNotFoundException Resolves and serves the request
TransactGetItems/TransactWriteItems with an ARN sub-op TableName ResourceNotFoundException Resolves and serves the request
Index ARN (.../table/T/index/i) as TableName ResourceNotFoundException ValidationException
Non-table resource type (.../stream/T) as TableName ResourceNotFoundException ValidationException
Malformed ARN as TableName ResourceNotFoundException ValidationException
Echoed table name (ConsumedCapacity.TableName, batch response keys) bare name the supplied ARN, verbatim
Valid-format ARN, missing table (control) ResourceNotFoundException ResourceNotFoundException
Bare (non-ARN) name, missing table (control) ResourceNotFoundException ResourceNotFoundException
  • Cross-account is not implemented. A foreign-account ARN resolves within the caller's account rather than returning AccessDeniedException.
  • The ARN region is ignored (no "Invalid AWS region" rejection).
  • Control-plane operations (e.g. DescribeTable) do not accept an ARN as name.

Why

Conformance gaps

Closes #

Testing done

  • New tests/test_table_arn_as_name.py: 16 dual-target cases

Checklist

  • I have read CONTRIBUTING.md
  • All tests pass (cargo test --workspace)
  • Code is formatted (cargo fmt --check)
  • Clippy is clean (cargo clippy -- -W clippy::pedantic)
  • I have added or updated tests for new functionality
  • I have updated documentation if behavior changed
  • Breaking changes are noted below (if any)
  • If this changes the wire protocol, Storage trait, auth model, on-disk
    format, or public CLI surface, an RFC has been accepted or is linked
    below. Otherwise, an ADR captures the decision (link below).

ADR / RFC:

Breaking changes

N/A

By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache License 2.0 and I agree to the Developer Certificate of
Origin (DCO). See CONTRIBUTING.md for details.

Resolve a table ARN supplied in place of a bare table name to its bare
name, matching Amazon DynamoDB and DynamoDB Local. Normalizes the wire
TableName, batch RequestItems keys, and transact sub-op table names in
the request path so authorization, validation, throttling, and echoed
names all see the bare name. Index, non-table, and malformed ARNs are
rejected as ValidationException. Account and region are ignored (name
resolves within the caller's account), matching DynamoDB Local.
@yesyayen
yesyayen force-pushed the fix/table-arn-as-name branch from 0ae86a3 to e60ea96 Compare July 2, 2026 17:44
@pdf-amzn

pdf-amzn commented Jul 2, 2026

Copy link
Copy Markdown
Collaborator

This is an interesting one. The intent of ARNs is that they are a globally unique reference to a resource (in some contexts, at that point in time, in other contexts, over all time). See https://docs.aws.amazon.com/IAM/latest/UserGuide/reference-arns.html for more.

With that in mind, maybe we should only accept ARNs with a partition of "extenddb" and when we initialize a extenddb instance, we generate a UUID to represent the "region"? But we'd want to reconcile that with our notion of sigv4 support and ARNs we already return to the user. I think current behavior is that the server's own region (used for ARNs, stream records, etc.) defaults to us-east-1 and is configurable via server.region in extenddb.toml, and ARNs returned do use "aws". Sigh. Seems like this needs a little more discussion.

/// Returns `ValidationException` when `name` begins with `arn:` but is not a
/// well-formed `table/<name>` ARN.
pub fn resolve_table_arn(name: &str) -> Result<&str, DynamoDbError> {
if !name.starts_with("arn:") {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This method brings to mind "parse, don't validate". Is it possible that eventually some of the other ARN elements will be useful? If so, is it worth considering now parsing a table arn into its constituent parts? If it fails to parse correctly, it's invalid. Otherwise, callers can access the specific parts they need. I'd be okay with deferring this in order to resolve the immediate problem, but wanted to raise the suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants